perm filename WORDCO.LSP[E83,JMC]1 blob
sn#720282 filedate 1983-07-23 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 wordco.lsp[e83,jmc] LISP word counter
C00004 ENDMK
Cā;
;;;wordco.lsp[e83,jmc] LISP word counter
(defun wordcount (file)
(do ((fileob (open file))
(count 0 (add1 count))
(line 'foo (readline fileob)))
((null line) (close fileob) count)
(do ((i 1 (add1 i))
(z 'foo (getchar line i)))
((null z))
(if (and (eq z '| |) (not (eq '| | (getchar line (add1 i)))))
(setq count (add1 count))))))
(setq base (setq ibase 12))
(wordcount '(psycho 4))